﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class c_GRN
    {
        public long arrive_id;// bigint NOT NULL,
        public string client;// nvarchar(25) NOT NULL,
        public DateTime deliv_date;// datetime NOT NULL,
        public string dim_2;// nvarchar(25) NOT NULL,
        public string dim_4;// nvarchar(25) NOT NULL,
        public string dim_5;// nvarchar(25) NOT NULL,
        public string ExecutionID;// nvarchar(50) NOT NULL,
        public string ext_inv_ref;// nvarchar(100) NOT NULL,
        public string ext_ord_ref;// nvarchar(100) NOT NULL,
        public int line_no;// int NOT NULL,
        public string location;// nvarchar(12) NOT NULL,
        public string lot;// nvarchar(10) NOT NULL,
        public long order_id;//bigint NOT NULL,
        public DateTime PickedUpDate;// datetime NOT NULL,
        public int PickedUpFlag;// int NOT NULL,
        public string reason_code;//nvarchar(2) NOT NULL,
        public string ResultDetails;// nvarchar(255) NOT NULL,
        public string user_id;// nvarchar(25) NOT NULL,
        public decimal vow_val;//decimal(28, 8) NOT NULL,
        public string warehouse;// nvarchar(25) NOT NULL,
        public long agrtid;// bigint IDENTITY(1,1) NOT NULL,

        public c_GRN(SqlDataReader rd)
        {
            arrive_id = rd["arrive_id"] is DBNull ? arrive_id : Convert.ToInt64(rd["arrive_id"]);
            client = rd["client"] is DBNull ? client : rd["client"].ToString();
            deliv_date = rd["deliv_date"] is DBNull ? deliv_date : Convert.ToDateTime(rd["deliv_date"]);
            dim_2 = rd["dim_2"] is DBNull ? dim_2 : rd["dim_2"].ToString();
            dim_4 = rd["dim_4"] is DBNull ? dim_4 : rd["dim_4"].ToString();
            dim_5 = rd["dim_5"] is DBNull ? dim_5 : rd["dim_5"].ToString();
            ExecutionID = rd["ExecutionID"] is DBNull ? ExecutionID : rd["ExecutionID"].ToString();
            ext_inv_ref = rd["ext_inv_ref"] is DBNull ? ext_inv_ref : rd["ext_inv_ref"].ToString();
            ext_ord_ref = rd["ext_ord_ref"] is DBNull ? ext_ord_ref : rd["ext_ord_ref"].ToString();
            line_no = rd["line_no"] is DBNull ? line_no : Convert.ToInt32(rd["line_no"]);
            location = rd["location"] is DBNull ? location : rd["location"].ToString();
            lot = rd["lot"] is DBNull ? lot : rd["lot"].ToString();
            order_id = rd["order_id"] is DBNull ? order_id : Convert.ToInt64(rd["order_id"]);
            PickedUpDate = rd["PickedUpDate"] is DBNull ? PickedUpDate : Convert.ToDateTime(rd["PickedUpDate"]);
            PickedUpFlag = rd["PickedUpFlag"] is DBNull ? PickedUpFlag : Convert.ToInt32(rd["PickedUpFlag"]);
            reason_code = rd["reason_code"] is DBNull ? reason_code : rd["reason_code"].ToString();
            ResultDetails = rd["ResultDetails"] is DBNull ? ResultDetails : rd["ResultDetails"].ToString();
            user_id = rd["user_id"] is DBNull ? user_id : rd["user_id"].ToString();
            vow_val = rd["vow_val"] is DBNull ? vow_val : Convert.ToDecimal(rd["vow_val"]);
            warehouse = rd["warehouse"] is DBNull ? warehouse : rd["warehouse"].ToString();
            agrtid = rd["agrtid"] is DBNull ? agrtid : Convert.ToInt32(rd["agrtid"]);
        }
    }
}
